<?php

namespace app\api\controller;

use app\api\validate\FranchiseValidate;
use app\common\controller\Api;

class Franchise extends Api
{
    protected $noNeedRight = ['*'];
    protected $noNeedLogin = ['*'];


    /**
     * Notes: 添加 加盟信息
     * User: chenLei
     * Date: 7/18/25
     */
    public function create()
    {
        $validate = new FranchiseValidate();
        if (!$validate->scene('create')->check(input('post.'))) {
            $this->error($validate->getError());
        }

        $franchise = new \app\common\model\Franchise();
        $res = $franchise->add(input('post.'));
        if ($res === false) {
            $this->error($franchise->getError());
        }

        $this->success('success');
    }
}